Error: GCC_ANALYZER_WARNING (CWE-688): [#def1] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/client.c: scope_hint: In function ‘send_listener_list’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/client.c:470:49: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘progname’ where non-null expected usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/client.c:41: included_from: Included from here. <built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null # 468| progname = strdup("unknown"); # 469| } # 470|-> char *idstring = malloc(strlen(progname) + 12); # 471| sprintf(idstring, "%u-%s", client->number, progname); # 472| Error: GCC_ANALYZER_WARNING (CWE-688): [#def2] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/client.c:471:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘idstring’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_sprintf’ must be non-null # 469| } # 470| char *idstring = malloc(strlen(progname) + 12); # 471|-> sprintf(idstring, "%u-%s", client->number, progname); # 472| # 473| plist_dict_set_item(l, "ID String", plist_new_string(idstring)); Error: GCC_ANALYZER_WARNING (CWE-476): [#def3] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/conf.c: scope_hint: In function ‘config_generate_uuid’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/conf.c:210:33: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘uuid’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/conf.c: scope_hint: In function ‘config_generate_uuid’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/conf.c: scope_hint: In function ‘config_generate_uuid’ # 208| continue; # 209| } else { # 210|-> uuid[i] = chars[get_rand(0, 16)]; # 211| } # 212| } Error: GCC_ANALYZER_WARNING (CWE-476): [#def4] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c: scope_hint: In function ‘send_packet’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c:219:24: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘buffer’ # 217| buffer = malloc(total); # 218| struct mux_header *mhdr = (struct mux_header *)buffer; # 219|-> mhdr->protocol = htonl(proto); # 220| mhdr->length = htonl(total); # 221| if (dev->version >= 2) { Error: GCC_ANALYZER_WARNING (CWE-688): [#def5] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c:231:9: warning[-Wanalyzer-null-argument]: use of NULL ‘header’ where non-null expected usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c:37: included_from: Included from here. usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c:29: included_from: Included from here. <built-in>: note: argument 2 of ‘__builtin_memcpy’ must be non-null # 229| dev->tx_seq++; # 230| } # 231|-> memcpy(buffer + mux_header_size, header, hdrlen); # 232| if(data && length) # 233| memcpy(buffer + mux_header_size + hdrlen, data, length); Error: GCC_ANALYZER_WARNING (CWE-401): [#def6] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c:235:11: warning[-Wanalyzer-malloc-leak]: leak of ‘buffer’ # 233| memcpy(buffer + mux_header_size + hdrlen, data, length); # 234| # 235|-> if((res = usb_send(dev->usbdev, buffer, total)) < 0) { # 236| usbmuxd_log(LL_ERROR, "usb_send failed while sending packet (len %d) to device %d: %d", total, dev->id, res); # 237| free(buffer); Error: GCC_ANALYZER_WARNING (CWE-688): [#def7] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c: scope_hint: In function ‘device_tcp_input’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c:675:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘buf’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 673| if(th->th_flags & TH_RST) { # 674| char *buf = malloc(payload_length+1); # 675|-> memcpy(buf, payload, payload_length); # 676| if(payload_length && (buf[payload_length-1] == '\n')) # 677| buf[payload_length-1] = 0; Error: GCC_ANALYZER_WARNING (CWE-476): [#def8] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c: scope_hint: In function ‘device_add’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c:837:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dev’ # 835| usbmuxd_log(LL_NOTICE, "Connecting to new device on location 0x%x as ID %d", usb_get_location(usbdev), id); # 836| dev = malloc(sizeof(struct mux_device)); # 837|-> dev->id = id; # 838| dev->usbdev = usbdev; # 839| dev->state = MUXDEV_INIT; Error: GCC_ANALYZER_WARNING (CWE-476): [#def9] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c: scope_hint: In function ‘device_get_list’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/device.c:945:31: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘p’ # 943| FOREACH(struct mux_device *dev, &dev_list) { # 944| if((dev->state == MUXDEV_ACTIVE) && (include_hidden || dev->visible)) { # 945|-> p->id = dev->id; # 946| p->serial = usb_get_serial(dev->usbdev); # 947| p->location = usb_get_location(dev->usbdev); Error: GCC_ANALYZER_WARNING (CWE-688): [#def10] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/log.c: scope_hint: In function ‘usbmuxd_log’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/log.c:75:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fs’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_sprintf’ must be non-null # 73| # 74| if(log_syslog) { # 75|-> sprintf(fs, "[%d] %s\n", level, fmt); # 76| } else { # 77| struct timeval ts; Error: GCC_ANALYZER_WARNING (CWE-688): [#def11] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/log.c:88:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fs’ where non-null expected usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/log.c:29: included_from: Included from here. /usr/include/time.h:99:15: note: argument 1 of ‘strftime’ must be non-null # 86| #endif # 87| # 88|-> strftime(fs, 10, "[%H:%M:%S", tp); # 89| sprintf(fs+9, ".%03d][%d] %s\n", (int)(ts.tv_usec / 1000), level, fmt); # 90| } Error: GCC_ANALYZER_WARNING (CWE-688): [#def12] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/main.c: scope_hint: In function ‘create_socket’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/main.c:100:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘hostname’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_strncpy’ must be non-null # 98| int res; # 99| # 100|-> strncpy(hostname, socket_addr, nlen-1); # 101| hostname[nlen-1] = '\0'; # 102| Error: GCC_ANALYZER_WARNING (CWE-775): [#def13] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/main.c: scope_hint: In function ‘daemonize’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/main.c:408:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pfd[0]’ # 406| // already a daemon # 407| if (getppid() == 1) # 408|-> return 0; # 409| # 410| if((res = pipe(pfd)) < 0) { Error: GCC_ANALYZER_WARNING (CWE-775): [#def14] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/main.c:408:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pfd[1]’ # 406| // already a daemon # 407| if (getppid() == 1) # 408|-> return 0; # 409| # 410| if((res = pipe(pfd)) < 0) { Error: GCC_ANALYZER_WARNING (CWE-476): [#def15] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/preflight.c: scope_hint: In function ‘preflight_worker_handle_device_add’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/preflight.c:137:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘_dev’ # 135| struct device_info *info = (struct device_info*)userdata; # 136| struct idevice_private *_dev = (struct idevice_private*)malloc(sizeof(struct idevice_private)); # 137|-> _dev->udid = strdup(info->serial); # 138| _dev->mux_id = info->id; # 139| _dev->conn_type = CONNECTION_USBMUXD; Error: GCC_ANALYZER_WARNING (CWE-688): [#def16] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/preflight.c: scope_hint: In function ‘preflight_worker_device_add’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/preflight.c:388:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘infocopy’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 386| struct device_info *infocopy = (struct device_info*)malloc(sizeof(struct device_info)); # 387| # 388|-> memcpy(infocopy, info, sizeof(struct device_info)); # 389| if (info->serial) { # 390| infocopy->serial = strdup(info->serial); Error: GCC_ANALYZER_WARNING (CWE-688): [#def17] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/usb.c: scope_hint: In function ‘usb_device_add’ usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/usb.c:773:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘usbdev’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null # 771| // Add the created handle to the device list, so we can close it in case of failure/disconnection # 772| usbdev = malloc(sizeof(struct usb_device)); # 773|-> memset(usbdev, 0, sizeof(*usbdev)); # 774| # 775| usbdev->serial[0] = 0; Error: GCC_ANALYZER_WARNING (CWE-476): [#def18] usbmuxd-1.1.1_20240915git0b1b233-build/usbmuxd-0b1b233b57d581515978a09e5a4394bfa4ee4962/src/usb.c:795:22: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘context’ # 793| usbmuxd_log(LL_INFO, "Requesting current mode from device %i-%i", bus, address); # 794| struct mode_context* context = malloc(sizeof(struct mode_context)); # 795|-> context->dev = dev; # 796| context->bus = bus; # 797| context->address = address;
analyzer-version-clippy | 1.82.0 |
analyzer-version-cppcheck | 2.16.0 |
analyzer-version-gcc | 14.2.1 |
analyzer-version-gcc-analyzer | 15.0.0 |
analyzer-version-shellcheck | 0.10.0 |
analyzer-version-unicontrol | 0.0.2 |
enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol |
exit-code | 0 |
host | ip-172-16-1-216.us-west-2.compute.internal |
mock-config | fedora-rawhide-gcc-latest-x86_64 |
project-name | usbmuxd-1.1.1^20240915git0b1b233-1.fc42 |
store-results-to | /tmp/tmp6s6_65fq/usbmuxd-1.1.1^20240915git0b1b233-1.fc42.tar.xz |
time-created | 2024-11-13 03:24:20 |
time-finished | 2024-11-13 03:25:39 |
tool | csmock |
tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp6s6_65fq/usbmuxd-1.1.1^20240915git0b1b233-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp6s6_65fq/usbmuxd-1.1.1^20240915git0b1b233-1.fc42.src.rpm' |
tool-version | csmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9 |